# ==============================================================================
# setup-packages.R
# author: Anselm Hager / Bernhard Clemm
# ==============================================================================

rm(list = ls())
options(scipen=999)
packages <- c("dplyr", "tidyverse", "plm", "did", "DRDID", "ggplot2",
              "readstata13", "stringr", "readtext", "readxl", "sf", "broom",
              "PanelMatch","fixest","didimputation","viridis",
              "tidytext", "tidyverse", "rstatix", "rvest", "stopwords",
              "foreign", "stargazer", "ggmap", "purrr", "ggpubr", "RColorBrewer")
new.packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
lapply(packages, require, character.only = TRUE)
rm(packages, new.packages)
dir <- dirname(dirname(rstudioapi::getSourceEditorContext()$path))